<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'vehicle.label', default: 'Vehicle')}"/>
    <title>新增贷款</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="menu" action="index">CINDATA</g:link>
                    </li>
                    <li class="active">
                        <span>新增贷款</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                新增贷款
            </h2>
        </div>
    </div>
</div>

<g:form action="save">
    <g:if test="${flash.message}">
        <div class="message alert alert-info" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${this.menu}">
        <ul class="errors" role="alert">
            <g:eachError bean="${this.menu}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>

    <g:hiddenField name="collateralId" value="${params['collateralId']}" />
    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    贷款基本信息
                </div>

                <div class="panel-body form-horizontal">

                    <div class="form-group">
                        <label class="col-md-2 control-label ">贷款编号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="serialNumber" id="serialNumber" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">放款日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="startDate" value="${new Date()}" precision="minute"/>
                        </div>

                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">贷款评估总价</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansEvaluateTotalPrice" id="loansEvaluateTotalPrice" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">贷款评估单价</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansEvaluatePrice" id="loansEvaluatePrice" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">贷款总金额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansAmount" id="loansAmount" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">抵押率</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="ltv" id="ltv" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">动态抵押率</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="cltv" id="cltv" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">贷款余额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansBalance" id="loansBalance" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">最初贷款到期日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="endDate" value="${new Date()}" precision="minute"/>
                        </div>

                        <label class="col-md-2 control-label ">抵押权人</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="mortgageeName" id="mortgageeName" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">房屋类型</label>
                        <div class="col-md-3">
                        <g:select class="form-control m-b" name="estateType" id="estateType" from="${com.cindata.dictionary.HouseTypeDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择房屋类型']}"/>
                        </div>

                        <label class="col-md-2 control-label ">受理机构网点</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="account" id="account" from="${com.cindata.Account.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择受理机构网点']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">受理机构名称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="accountName" id="accountName" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">是否首套房</label>
                        <div class="col-md-3">
                            <g:select class="form-control" name="isFirstHouse" id="isFirstHouse" from="${['true','false']}" value="${this.vehicle?.isApplayPurchaseAsset}" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">首付金额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="downPaymentAmount" id="downPaymentAmount" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">公积金贷款金额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="publicFundLoansAmount" id="publicFundLoansAmount" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">商业贷款金额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="bankLoansAmount" id="bankLoansAmount" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">放款银行名称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansBankName" id="loansBankName" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">最初应还款期数</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="loansDuration" id="loansDuration" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">最初还款方式</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="startRepayMentMode" id="startRepayMentMode" from="${com.cindata.dictionary.RepaymentModeDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择最初还款方式']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">每月应还款日</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="repaymentDate" id="repaymentDate" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">提前放款步骤</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="forwardLoanStep" id="forwardLoanStep" from="${com.cindata.dictionary.ForwardLoanStepDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择提前放款步骤']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">放款方式</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="loanMethod" id="loanMethod" from="${com.cindata.dictionary.LoanMethodDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择放款方式']}"/>

                        </div>

                        <label class="col-md-2 control-label ">当前还款方式</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="curRepaymentMode" id="curRepaymentMode" from="${com.cindata.dictionary.RepaymentModeDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择当前还款方式']}"/>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">正常还款总本金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curNormalTotalCapital" id="curNormalTotalCapital" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">提前还款总本金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curInAdvanceTotalCapital" id="curInAdvanceTotalCapital" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">逾期还款总本金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curOverdueTotalCapital" id="curOverdueTotalCapital" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">当前回收总本金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curRecycleTotalCapital" id="curRecycleTotalCapital" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">当前回收总利息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curRecycleTotalInterest" id="curRecycleTotalInterest" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">当前回收总罚息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curRecycleTotalFine" id="curRecycleTotalFine" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">当前已还款期数(含转逾期)</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curHasPaymentTODuration" id="curHasPaymentTODuration" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">当前已还款期数(不含转逾期)</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curHasPaymentDuration" id="curHasPaymentDuration" value=""/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">当前剩余还款期数</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="remainTime" id="remainTime" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">担保方式</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="guaranteeMethod" id="guaranteeMethod" from="${com.cindata.dictionary.GuaranteeMethodDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择担保方式']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">担保机构</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="guaranteeInstitution" id="guaranteeInstitution" from="${com.cindata.Account.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择担保机构']}"/>
                        </div>

                        <label class="col-md-2 control-label ">贷款状态</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="mortgageStatus" id="mortgageStatus" from="${com.cindata.dictionary.MortgageStatusDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择贷款状态']}"/>
                        </div>

                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">是否命中犯欺诈</label>
                        <div class="col-md-3">
                            <g:select class="form-control" name="isAntiFraud" id="isAntiFraud" from="${['true','false']}" value="${this.vehicle?.isApplayPurchaseAsset}" />
                        </div>

                        <label class="col-md-2 control-label ">当前贷款还款状态</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="curRepaymentState" id="curRepaymentState" from="${com.cindata.dictionary.RepaymentStateDict.list()}" optionValue="name" optionKey="id" value="${this.vehicle?.type?.id}" noSelection="${['': '请选择当前贷款还款状态']}"/>

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">当前逾期总期数</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="curOverdueDuration" id="curOverdueDuration" value=""/>
                        </div>

                        <label class="col-md-2 control-label ">最后扣款日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="lastPayAt" value="${new Date()}" precision="minute"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">最后还清时间</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="payOffAt" value="${new Date()}" precision="minute"/>
                        </div>

                    </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info" name="create" value="保存"/>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>



</g:form>

<g:javascript>
    $(function () {
        $('.datepicker').datepicker({
            language: 'zh-CN',
            format:"yyyy-mm-dd"
        });
        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });
    });

    // $("#city").bind("change", function(){
    //     $("#district option").remove();
    //     $("#s2id_district span:first").html("请选择行政区");
    //     var city = $("#city").val()
    //     $("#district").append("<option value='-1' >请选择行政区</option>")
    //     if(city=='-1'){
    //         return
    //     }
    //     $.ajax({
    //         url: "/estate/districtList",
    //         type: "POST",
    //         data: {'city': city} ,
    //         success: function(result){
    //             for(var i=0; i < result.districtList.length; i++){
    //                 $("#district").append("<option value=" + result.districtList[i].zoneNumber + ">" + result.districtList[i].name + "</option>")
    //             }
    //         }
    //     });
    // });
    // $("#city").change();

</g:javascript>
</body>
</html>
